<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>书写一个构造函数，用来创建学生对象</title>
    <script>
        function Student(uname, id, sex, grade,) {
            this.name = uname;
            this.id = id;
            this.sex = sex;
            this.grade = grade;
            this.sayhi = function () {
                alert('你好我是' + this.name);
            }
        }
        var fjj = new Student('骄骄', 21, '男', 100);
        console.log(fjj.name);
        console.log(fjj.id);
        console.log(fjj.sex);
        console.log(fjj['grade']);
        fjj.sayhi();
    </script>
</head>

<body>

</body>

</html>